/*
 * User
 *
 * This class encapsulates a learner who uses the SASL Tutor software.
 * It can be serialised as an XML DOM node.
 */

#ifndef USER_H
#define USER_H

#include <QString>
#include <QDate>
#include <QDomElement>
#include <QList>

#include "progressitem.h"

class User {
public:
	// default constructor
	User();
	// parameterised constructor
	User(const QString& n);

	// mutators
	void setName(const QString& n);
	void setImageFilename(const QString& f);
	void setLastLogin(const QDate& d);
        void addProgressItem(const ProgressItem& i);
        void modifyProgressItem(const ProgressItem& i);

	// accessors
	const QString& getName() const;
	const QString& getImageFilename() const;
	const QDate& getLastLogin() const;
        QList<ProgressItem> getProgress() const;

	const QDate& getDateCreated() const;

	// convert to xml dom node
	QDomElement& toDomElement(QDomElement& node);
	// convert from xml dom node
	void fromDomElement(QDomElement& node);

        // equality operator. equality defined as
        // equal usernames
        bool operator== (const User& other) const;

private:
	// user name
	QString name;

	// user image path
	QString imageFilename;

	// last login
	QDate lastLogin;

	// date of account creation
	QDate dateCreated;

        // the progress items which constitute this user's
        // progress report
        QList<ProgressItem> progress;
};

#endif // USER_H
